#!/bin/bash
root=$(realpath $(cd $(dirname $0) && pwd)/../)
requirements_path=$(realpath $root/tools/requirements.txt)
venv_path=$(realpath $root/../.venv)

if [ -f $venv_path/bin/python3 ]; then
    echo "Virtual environment already exists"
else
    echo "Creating virtual environment"
    rm -rf $venv_path
    python3 -m venv $venv_path
fi
source $venv_path/bin/activate
pip install -r $requirements_path -i https://pypi.tuna.tsinghua.edu.cn/simple